/**
 * Created by 小敏哥 on 2018/1/8.
 */
import React, {Component} from 'react';
import style from './index.scss';

class CarItem extends Component {
    constructor(props) {
        super(props);
    }

    static propTypes= {
        carId:React.PropTypes.string,//车辆id
        carNumber:React.PropTypes.string,//车牌
        count:React.PropTypes.number,//次数
        fine:React.PropTypes.number,//罚款
        degree:React.PropTypes.number,//扣分
    };

    goToIllegalDetailList(){
        this.context.router.push(`illegalDetailList/${this.props.carId}/${encodeURIComponent(this.props.carNumber)}`);
    }

    render() {
        return <div className={style.carItem} onClick={this.goToIllegalDetailList.bind(this)}>
            <div className={style.header}><span>{this.props.carNumber}</span><img src="./images/arrowright_blac.png"/></div>
            <div className={style.content}>
                <div><span>违章</span><span>罚款</span><span>扣分</span></div>
                <div><span>{`${this.props.count}次`}</span><span>{`${this.props.fine}元`}</span><span>{`${this.props.degree}分`}</span></div>
            </div>
        </div>
    }
}

//使用context
CarItem.contextTypes = {
    router: React.PropTypes.object.isRequired
};


export default CarItem